\hypertarget{class_network}{\section{Network类 参考}
\label{class_network}\index{Network@{Network}}
}


网络类,提供对网络设别的常用操作.  




{\ttfamily \#include $<$Network.\+h$>$}

\subsection*{Public 成员函数}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_network_a71b6065c80dfb6c819287c959045d2ae}{std\+::string {\bfseries get\+Subnet\+I\+P} (const std\+::string gateway\+I\+P, const std\+::string subnet\+Mask, sint32 sub\+Index)}\label{class_network_a71b6065c80dfb6c819287c959045d2ae}

\end{DoxyCompactItemize}
\subsection*{静态 Public 成员函数}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_network_a0e0558dc6c5301761cf4299142e71cd1}{static bool {\bfseries is\+Valid\+I\+P} (const std\+::string ip)}\label{class_network_a0e0558dc6c5301761cf4299142e71cd1}

\item 
static std\+::string \hyperlink{class_network_a32387be250c452d4753104c35feef396}{get\+Inet\+Addr} (const std\+::string intf)
\begin{DoxyCompactList}\small\item\em 获取网口ip地址 \end{DoxyCompactList}\item 
static std\+::string \hyperlink{class_network_ac5383fcfa9c6e1ca9054023764dd8bc1}{get\+Mask\+Addr} (const std\+::string intf)
\begin{DoxyCompactList}\small\item\em 获取网口子网掩码地址 \end{DoxyCompactList}\item 
static std\+::string \hyperlink{class_network_a398762dc97e710378366dc7644332a99}{get\+Mac\+Addr} (const std\+::string intf)
\begin{DoxyCompactList}\small\item\em 获取网口mac地址 \end{DoxyCompactList}\item 
static sint32 \hyperlink{class_network_a5be3dd99aaae9dfd86ea2460b5e17514}{get\+If\+Up\+Down} (const std\+::string intf)
\begin{DoxyCompactList}\small\item\em 获取网口状态 \end{DoxyCompactList}\item 
static sint32 \hyperlink{class_network_ae34c41b000df924c0d2ec597f1299786}{set\+Inet\+Addr} (const std\+::string intf, const std\+::string ipaddr)
\begin{DoxyCompactList}\small\item\em 设置网口ip地址 \end{DoxyCompactList}\item 
static sint32 \hyperlink{class_network_a17fb128c761e6aa129818ac29eb01852}{set\+Mask\+Addr} (const std\+::string intf, const std\+::string netmask)
\begin{DoxyCompactList}\small\item\em 设置网口子网掩码地址 \end{DoxyCompactList}\item 
static sint32 \hyperlink{class_network_aa6bf9ae4135cdd1941a4af0d153b69f4}{set\+Mac\+Addr} (const std\+::string intf, const std\+::string mac)
\begin{DoxyCompactList}\small\item\em 设置网口mac地址 \end{DoxyCompactList}\item 
static sint32 \hyperlink{class_network_a28633da6000b20a86816b11b1f6b2a8b}{set\+If\+Up\+Down} (const std\+::string intf, sint32 up\+Or\+Down)
\begin{DoxyCompactList}\small\item\em 设置网口状态 \end{DoxyCompactList}\item 
static std\+::string \hyperlink{class_network_a2c8eac1c0493e3a2748e3a2f23586978}{dhcp\+Client\+Get\+I\+P} (const std\+::string intf)
\begin{DoxyCompactList}\small\item\em dhcp动态获取ip地址 \end{DoxyCompactList}\item 
\hypertarget{class_network_a4a512e9f3c683c1c3d1d17505c2cb28f}{static sint32 {\bfseries check\+Subnet\+I\+P} (const std\+::string gateway\+I\+P, const std\+::string subnet\+Mask, std\+::string \&subnet\+I\+P)}\label{class_network_a4a512e9f3c683c1c3d1d17505c2cb28f}

\item 
\hypertarget{class_network_a6a4fc6f794478f1ec0a07f414049bbdb}{static sint32 {\bfseries get\+If\+Link\+Up\+Down} (const std\+::string intf)}\label{class_network_a6a4fc6f794478f1ec0a07f414049bbdb}

\end{DoxyCompactItemize}


\subsection{详细描述}
网络类,提供对网络设别的常用操作. 

\subsection{成员函数说明}
\hypertarget{class_network_a2c8eac1c0493e3a2748e3a2f23586978}{\index{Network@{Network}!dhcp\+Client\+Get\+I\+P@{dhcp\+Client\+Get\+I\+P}}
\index{dhcp\+Client\+Get\+I\+P@{dhcp\+Client\+Get\+I\+P}!Network@{Network}}
\subsubsection[{dhcp\+Client\+Get\+I\+P}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string Network\+::dhcp\+Client\+Get\+I\+P (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a2c8eac1c0493e3a2748e3a2f23586978}


dhcp动态获取ip地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
动态获取成功返回\+I\+P地址字符串,获取失败返回空字符串 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_a5be3dd99aaae9dfd86ea2460b5e17514}{\index{Network@{Network}!get\+If\+Up\+Down@{get\+If\+Up\+Down}}
\index{get\+If\+Up\+Down@{get\+If\+Up\+Down}!Network@{Network}}
\subsubsection[{get\+If\+Up\+Down}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Network\+::get\+If\+Up\+Down (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a5be3dd99aaae9dfd86ea2460b5e17514}


获取网口状态 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回网口状态(I\+N\+T\+F\+::\+D\+O\+W\+N或者\+I\+N\+T\+F\+::\+U\+P),获取失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_a32387be250c452d4753104c35feef396}{\index{Network@{Network}!get\+Inet\+Addr@{get\+Inet\+Addr}}
\index{get\+Inet\+Addr@{get\+Inet\+Addr}!Network@{Network}}
\subsubsection[{get\+Inet\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string Network\+::get\+Inet\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a32387be250c452d4753104c35feef396}


获取网口ip地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
I\+P地址字符串,获取失败返回空字符串 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_a398762dc97e710378366dc7644332a99}{\index{Network@{Network}!get\+Mac\+Addr@{get\+Mac\+Addr}}
\index{get\+Mac\+Addr@{get\+Mac\+Addr}!Network@{Network}}
\subsubsection[{get\+Mac\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string Network\+::get\+Mac\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a398762dc97e710378366dc7644332a99}


获取网口mac地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
mac地址字符串,获取失败返回空字符串 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_ac5383fcfa9c6e1ca9054023764dd8bc1}{\index{Network@{Network}!get\+Mask\+Addr@{get\+Mask\+Addr}}
\index{get\+Mask\+Addr@{get\+Mask\+Addr}!Network@{Network}}
\subsubsection[{get\+Mask\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string Network\+::get\+Mask\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_ac5383fcfa9c6e1ca9054023764dd8bc1}


获取网口子网掩码地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
I\+P地址字符串,获取失败返回空字符串 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_a28633da6000b20a86816b11b1f6b2a8b}{\index{Network@{Network}!set\+If\+Up\+Down@{set\+If\+Up\+Down}}
\index{set\+If\+Up\+Down@{set\+If\+Up\+Down}!Network@{Network}}
\subsubsection[{set\+If\+Up\+Down}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Network\+::set\+If\+Up\+Down (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf, }
\item[{sint32}]{up\+Or\+Down}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a28633da6000b20a86816b11b1f6b2a8b}


设置网口状态 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
{\em up\+Or\+Down} & I\+N\+T\+F\+::\+D\+O\+W\+N或者\+I\+N\+T\+F\+:U\+P \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,获取失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_ae34c41b000df924c0d2ec597f1299786}{\index{Network@{Network}!set\+Inet\+Addr@{set\+Inet\+Addr}}
\index{set\+Inet\+Addr@{set\+Inet\+Addr}!Network@{Network}}
\subsubsection[{set\+Inet\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Network\+::set\+Inet\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf, }
\item[{const std\+::string}]{ipaddr}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_ae34c41b000df924c0d2ec597f1299786}


设置网口ip地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
{\em ipaddr} & ip地址字符串 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
设置成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_aa6bf9ae4135cdd1941a4af0d153b69f4}{\index{Network@{Network}!set\+Mac\+Addr@{set\+Mac\+Addr}}
\index{set\+Mac\+Addr@{set\+Mac\+Addr}!Network@{Network}}
\subsubsection[{set\+Mac\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Network\+::set\+Mac\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf, }
\item[{const std\+::string}]{mac}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_aa6bf9ae4135cdd1941a4af0d153b69f4}


设置网口mac地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
{\em mac} & mac地址字符串 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
设置成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_network_a17fb128c761e6aa129818ac29eb01852}{\index{Network@{Network}!set\+Mask\+Addr@{set\+Mask\+Addr}}
\index{set\+Mask\+Addr@{set\+Mask\+Addr}!Network@{Network}}
\subsubsection[{set\+Mask\+Addr}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Network\+::set\+Mask\+Addr (
\begin{DoxyParamCaption}
\item[{const std\+::string}]{intf, }
\item[{const std\+::string}]{netmask}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_network_a17fb128c761e6aa129818ac29eb01852}


设置网口子网掩码地址 


\begin{DoxyParams}{参数}
{\em intf} & 网口名称,如eth0 \\
\hline
{\em netmask} & 子网掩码ip地址字符串 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
设置成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}


该类的文档由以下文件生成\+:\begin{DoxyCompactItemize}
\item 
libemb/inc/\hyperlink{_network_8h}{Network.\+h}\item 
libemb/src/Network.\+cpp\end{DoxyCompactItemize}
